<template>
	<view>
		<uni-nav-bar title="广告播放记录" left-icon="back" @clickLeft="$timeGoBack(0)" :border="false" :fixed="true"
			:statusBar="true"></uni-nav-bar>
		<view class="" style="background-color: #F8F8F8;height: 16rpx;">

		</view>
		<view class="px-20">
			<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :fixed="false">
				<view class="" v-for="item in list" :key="item.id">
					<view class="py-32 flex align-center justify-between">
						<view class="">
							{{item.createUserTemp.nickName}}
						</view>
						<view class="text-gray">
							{{item.createTime}}
						</view>
					</view>
					<u-line color="#F3F3F3"></u-line>
				</view>
			</s-pull-scroll>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.refresh();
		},
		methods: {
			refresh() {
				this.$nextTick(() => {
					this.$refs.pullScroll.refresh();
				});
			},
			pullDown(pullScroll) {
				setTimeout(() => {
					this.loadData(pullScroll);
				}, 200);
			},
			loadData(pullScroll) {
				setTimeout(() => {
					if (pullScroll.page == 1) {
						this.list = [];
					}
					this.$Api.advertising.advertrecord({
						pageNum:pullScroll.page,
						pageSize:20
					}).then(res=>{
						console.log(res,'广告观看记录')
						if (pullScroll.page == 1 && res.total == 0) {
							pullScroll.empty();
						}
						this.list = this.list.concat(res.rows || []);
						if (this.list.length >= res.total) {
							pullScroll.finish();
						} else {
							pullScroll.success();
						}
					})
				}, 500);
			}
		}
	}
</script>

<style>

</style>